delegateResource
After staking and obtaining resources, resources can be delegated to multiple recipients through this interface. The optional lock
parameter can specify whether the delegation can be revoked within 3 days. (v5.1.0 new interface)
Usage
tronWeb.transactionBuilder.delegateResource(amount, receiverAddress, resource, address, lock, lockPeriod, options);
Parameters
Argument | Description | Type |
---|---|---|
amount | The amount of assets in sun to be delegated, larger than 0 | Integer |
receiverAddress | The account address of receiving delegation (base58 or hex) | String |
resource | Asset type to be delegated. Optional, the default is BANDWIDTH . | BANDWIDTH or ENERGY |
address | Owner address (base58 or hex) | String |
lock | If the lock is true , delegation can not be revoked within 3 days. The default is false | Boolean |
lockPeriod | When lock is true , this parameter will set the lock time, with the unit of blocks. And the new resource delegating to the same address of same type should have this lockPeriod value larger than the lockup blocks left of the address. | Integer |
options | The permission id, optional, for multi-signature and block header for contract block header info. | { permissionId: number, blockHeader: ... } |
Returns
Unsigned transaction object.
Example
> const transaction = await tronWeb.transactionBuilder.delegateResource(10e6, 'receiverAddress', 'BANDWIDTH', 'ownerAddress', true, 86400);